home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / prg_basi / ddfedit.zip / DDFNWIDX.FRM < prev    next >
Text File  |  1996-02-05  |  9KB  |  311 lines

  1. VERSION 2.00
  2. Begin Form FormNewIndex 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Add New Index"
  6.    ClientHeight    =   1860
  7.    ClientLeft      =   2955
  8.    ClientTop       =   3690
  9.    ClientWidth     =   4380
  10.    ControlBox      =   0   'False
  11.    Height          =   2265
  12.    Left            =   2895
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   1860
  17.    ScaleWidth      =   4380
  18.    Top             =   3345
  19.    Width           =   4500
  20.    Begin SSPanel Panel3D1 
  21.       AutoSize        =   3  'AutoSize Child To Panel
  22.       BevelInner      =   1  'Inset
  23.       BevelOuter      =   0  'None
  24.       BorderWidth     =   1
  25.       Caption         =   "Panel3D1"
  26.       Height          =   375
  27.       Left            =   45
  28.       TabIndex        =   20
  29.       Top             =   45
  30.       Width           =   4245
  31.       Begin ComboBox FieldList 
  32.          Height          =   315
  33.          Left            =   30
  34.          Style           =   2  'Dropdown List
  35.          TabIndex        =   21
  36.          Top             =   30
  37.          Width           =   4185
  38.       End
  39.    End
  40.    Begin CommandButton ButOk 
  41.       Caption         =   "OK"
  42.       Default         =   -1  'True
  43.       Height          =   330
  44.       Left            =   3060
  45.       TabIndex        =   19
  46.       Top             =   1440
  47.       Width           =   1230
  48.    End
  49.    Begin CommandButton butcan 
  50.       Cancel          =   -1  'True
  51.       Caption         =   "Cancel"
  52.       Height          =   330
  53.       Left            =   1665
  54.       TabIndex        =   18
  55.       Top             =   1440
  56.       Width           =   1230
  57.    End
  58.    Begin TextBox XFDid 
  59.       Height          =   285
  60.       Left            =   315
  61.       TabIndex        =   17
  62.       Top             =   1440
  63.       Visible         =   0   'False
  64.       Width           =   180
  65.    End
  66.    Begin TextBox XFDName 
  67.       Height          =   285
  68.       Left            =   570
  69.       TabIndex        =   16
  70.       Top             =   1440
  71.       Visible         =   0   'False
  72.       Width           =   180
  73.    End
  74.    Begin TextBox XFDLocation 
  75.       Height          =   285
  76.       Left            =   810
  77.       TabIndex        =   15
  78.       Top             =   1440
  79.       Visible         =   0   'False
  80.       Width           =   180
  81.    End
  82.    Begin TextBox XFDFlags 
  83.       Height          =   285
  84.       Left            =   1035
  85.       TabIndex        =   14
  86.       Top             =   1440
  87.       Visible         =   0   'False
  88.       Width           =   180
  89.    End
  90.    Begin TextBox XPath 
  91.       Height          =   285
  92.       Left            =   90
  93.       TabIndex        =   13
  94.       Top             =   1440
  95.       Visible         =   0   'False
  96.       Width           =   180
  97.    End
  98.    Begin TextBox IndexIdx 
  99.       Height          =   285
  100.       Left            =   1260
  101.       TabIndex        =   12
  102.       Top             =   1440
  103.       Visible         =   0   'False
  104.       Width           =   180
  105.    End
  106.    Begin TextBox IndexNewPart 
  107.       Height          =   285
  108.       Left            =   1530
  109.       TabIndex        =   11
  110.       Top             =   1440
  111.       Visible         =   0   'False
  112.       Width           =   180
  113.    End
  114.    Begin SSFrame Frame3D1 
  115.       Caption         =   "Key Flags"
  116.       ForeColor       =   &H00000000&
  117.       Height          =   825
  118.       Left            =   45
  119.       TabIndex        =   0
  120.       Top             =   495
  121.       Width           =   4245
  122.       Begin SSCheck KeyFlag 
  123.          Caption         =   "MAN"
  124.          Height          =   195
  125.          Index           =   9
  126.          Left            =   3330
  127.          TabIndex        =   10
  128.          Top             =   495
  129.          Width           =   825
  130.       End
  131.       Begin SSCheck KeyFlag 
  132.          Caption         =   "EXT"
  133.          Height          =   195
  134.          Index           =   8
  135.          Left            =   2520
  136.          TabIndex        =   9
  137.          Top             =   495
  138.          Value           =   -1  'True
  139.          Width           =   825
  140.       End
  141.       Begin SSCheck KeyFlag 
  142.          Caption         =   "SUP"
  143.          Height          =   195
  144.          Index           =   7
  145.          Left            =   1710
  146.          TabIndex        =   8
  147.          Top             =   495
  148.          Width           =   825
  149.       End
  150.       Begin SSCheck KeyFlag 
  151.          Caption         =   "DEC"
  152.          Height          =   195
  153.          Index           =   6
  154.          Left            =   900
  155.          TabIndex        =   7
  156.          Top             =   495
  157.          Width           =   825
  158.       End
  159.       Begin SSCheck KeyFlag 
  160.          Caption         =   "SEQ"
  161.          Height          =   195
  162.          Index           =   5
  163.          Left            =   90
  164.          TabIndex        =   6
  165.          Top             =   495
  166.          Width           =   825
  167.       End
  168.       Begin SSCheck KeyFlag 
  169.          Caption         =   "SEG"
  170.          Height          =   195
  171.          Index           =   4
  172.          Left            =   3330
  173.          TabIndex        =   5
  174.          Top             =   270
  175.          Width           =   825
  176.       End
  177.       Begin SSCheck KeyFlag 
  178.          Caption         =   "NULL"
  179.          Height          =   195
  180.          Index           =   3
  181.          Left            =   2520
  182.          TabIndex        =   4
  183.          Top             =   270
  184.          Width           =   825
  185.       End
  186.       Begin SSCheck KeyFlag 
  187.          Caption         =   "BIN"
  188.          Height          =   195
  189.          Index           =   2
  190.          Left            =   1710
  191.          TabIndex        =   3
  192.          Top             =   270
  193.          Width           =   825
  194.       End
  195.       Begin SSCheck KeyFlag 
  196.          Caption         =   "MOD"
  197.          Height          =   195
  198.          Index           =   1
  199.          Left            =   900
  200.          TabIndex        =   2
  201.          Top             =   270
  202.          Width           =   825
  203.       End
  204.       Begin SSCheck KeyFlag 
  205.          Caption         =   "DUP"
  206.          Height          =   195
  207.          Index           =   0
  208.          Left            =   90
  209.          TabIndex        =   1
  210.          Top             =   270
  211.          Width           =   825
  212.       End
  213.    End
  214. End
  215. Option Explicit
  216.  
  217. 'Type XDIndex_def
  218. '  XiDFile As Integer   ' File ID (XfDid in  FILE.DDF Above)
  219. '  XiDField As Integer  ' Filed ID (XeDid in FILED.DFF above)
  220. '  XiDNumber As Integer ' Key Number (0-->)
  221. '  XiDPart As Integer   ' Key Part (Segment of above, from 0-->)
  222. '  XiDFlags As Integer  ' Flags of Key
  223. 'End Type
  224.  
  225. ' XiDFlags can be :
  226. '   K_DUP = 1
  227. '   K_MOD = 2
  228. '   K_BIN = 4
  229. '   K_NUL = 8
  230. '   K_SEG = 16
  231. '   K_SEQ = 32
  232. '   K_DEC = 64
  233. '   K_SUP = 128
  234. '   K_EXT = 256
  235. '   K_MAN = 512
  236.  
  237. Sub butcan_Click ()
  238.   Unload Me
  239. End Sub
  240.  
  241. Sub ButOk_Click ()
  242.   Dim NewIndexNumber As Integer
  243.   Dim i As Integer
  244.   Dim FormID As Integer
  245.   Dim nid As Integer
  246.   Dim npart As Integer
  247.   Dim Flags As Integer
  248.   Dim FieldID As Integer
  249.  
  250.   ' what's he doing
  251.   ' look at IndexId, and IndexNewPart
  252.   ' is it :
  253.   ' A completely new index then
  254.   '   IndexId = -1
  255.   ' A New Part to an index then
  256.   '   IndexId is the line on the list
  257.   '   IndexNewPart=1
  258.   ' Editing an Index then
  259.   '   IndexId is the line on the list
  260.   '   IndexNewPart=0
  261.  
  262.   FormID = -1
  263.   For i = 0 To Forms.Count - 1
  264.     If Forms(i).Tag = "D" & Trim(xfdid.Text) Then
  265.       FormID = i
  266.       Exit For
  267.     End If
  268.   Next i
  269.  
  270.   If FormID = -1 Then
  271.     MsgBox "ERROR : Can't find parent form"
  272.     Exit Sub
  273.   End If
  274.  
  275.   nid = Val(IndexIdx.Text)
  276.   npart = Val(IndexNewPart.Text)
  277.  
  278.   Flags = 0
  279.   For i = 0 To 9
  280.     If KeyFlag(i).Value Then Flags = Flags + 2 ^ i
  281.   Next i
  282.  
  283.   
  284.   
  285.   If nid = -1 Then ' a completely new index !
  286.     Forms(FormID).Llist.AddItem Format(999, "0") & Chr(9) & "0" & Chr(9) & Format(FieldList.ItemData(FieldList.ListIndex), "0") & Chr(9) & FieldList.List(FieldList.ListIndex) & Chr(9) & Format(Flags, "0")
  287.   Else
  288.     If npart = 0 Then ' He's editing
  289.       FieldID = Forms(FormID).Llist.ItemData(nid)
  290.       Forms(FormID).Llist.RemoveItem nid
  291.       Forms(FormID).Llist.AddItem Format(FieldID, "0") & Chr(9) & "0" & Chr(9) & Format(FieldList.ItemData(FieldList.ListIndex), "0") & Chr(9) & FieldList.List(FieldList.ListIndex) & Chr(9) & Format(Flags, "0"), nid
  292.     Else ' Its a New Part to the index
  293.       FieldID = Forms(FormID).Llist.ItemData(nid)
  294.       Forms(FormID).Llist.AddItem Format(FieldID, "0") & Chr(9) & "0" & Chr(9) & Format(FieldList.ItemData(FieldList.ListIndex), "0") & Chr(9) & FieldList.List(FieldList.ListIndex) & Chr(9) & Format(Flags, "0"), nid + 1
  295.     End If
  296.   End If
  297.   
  298.   Curr_File_changed = True
  299.   
  300.   Unload Me
  301.  
  302. End Sub
  303.  
  304. Sub Form_Load ()
  305.  
  306.   left = (screen.Width - Width) / 2
  307.   top = (screen.Height - Height) / 2
  308.  
  309. End Sub
  310.  
  311.